(function () {
	'use strict';
	
	angular.module('app').controller('appController', appController);
	appController.$inject = ['appService'];
	
	function appController(appService){
	    $scope.login = function(data){
			appService.login(data).then(fun(resp){
			   if(resp.status=200){
			     $cookies.put('user', resp.data.user);
					///
			     $rootScope.$broadcast('loginSuccess', $state.previous);
			   }
			});
	    };
	}
	
})();